import { Reducer, Effect, Subscription } from 'umi';

export interface UserModelState {
    demo: any;
}

export interface UserModelType {
    namespace: 'user';
    state: UserModelState;
    effects: {
        indexDemo: Effect;
    };
    reducers: {
        save: Reducer<UserModelState>;
    };
    subscription: {
        setup: Subscription;
    };
}

const UserModel: UserModelType = {
    namespace: 'user',
    state: {
        demo: 'demo',
    },
    effects: {
        *indexDemo({ payload }, { call, put }) { },
    },
    reducers: {
        save(state, { payload }) {
            return {
                ...state,
                ...payload,
            };
        },
    },
    subscription: {
        setup() { },
    },
};

export default UserModel;
